import axios from './request'

//一个api接口 封装成一个函数

//登录接口
function user_login(params = {}) {
    return axios.post('/api/user/login', params);
}
//搜索接口
function search(params = {}){
    return axios.get('/api/shop/search', { params });
}
//注册接口
function user_register(params = {}) {
    return axios.post('/api/user/register', params);
}
//店铺列表
function shop_list(params = {}) {
    return axios.get('/api/shop/list', { params });
}
//店铺详情
function shop_shopinfo(params = {}) {
    return axios.get('/api/shop/shopinfo', { params });
}
//店铺收藏列表
function shop_favlist(params = {}) {
    return axios.get('/api/shop/favlist', { params });
}
//轮播图接口
function banner_list(params = {}) {
    return axios.get('/api/banner/list', { params });
}
//爆爆团接口
function tuan_list(params = {}) {
    return axios.get('/api/tuan/list', { params });
}
//收藏店铺
function shop_fav(params = {}) {
    return axios.post('/api/shop/fav', params);
}
//取消收藏列表
function shop_unfav(params = {}) {
    return axios.post('/api/shop/unfav', params);
}
//数量加一
function shopcart_add(params = {}) {
    return axios.post('/api/shopcart/add', params);
}
//数量减一
function shopcart_sub(params = {}) {
    return axios.post('/api/shopcart/sub', params);
}
//
function shopcart_list(params = {}) {
    return axios.get('/api/shopcart/list', { params });
}

//抛出所有函数
export {
    user_login,
    user_register,
    shop_list,
    shop_shopinfo,
    shop_favlist,
    banner_list,
    tuan_list,
    shop_fav,
    shop_unfav,
    shopcart_add,
    shopcart_sub,
    shopcart_list,
    search
}
